package com.gt.consumer;

import com.alibaba.dubbo.config.annotation.Reference;
import com.gt.model.User;
import com.gt.service.DemoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConsumerController {
    @Reference
    DemoService demoService;

    User user = new User(11,"测试","hello word !");

    @GetMapping("/add")
    public void add(Integer a, Integer b){
        System.out.println(demoService.add(a, b));
        System.err.println();
        System.err.printf("list=%s", demoService.toList(1, "22", true, 'b' , user));
        System.err.println();
        System.err.println(demoService.getUser(user));
        try {
            demoService.throwsThroeable();
        } catch (Exception e) {
            System.err.println(e.getMessage());
        }
    }
}
